package com.maimao.model.goods.log;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.deser.std.NumberDeserializers;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 商品发布/修改 审核记录
 *
 * @author MaoLin Wang
 * @date 2021/3/22 12:56 下午
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
@Builder
public class GoodsCheck implements Serializable {

    private static final long serialVersionUID = -7664366920457548992L;

    public static final String GOODS_ID_FIELD = "goodsId";
    public static final String BRAND_ID_FIELD = "brandId";
    public static final String GOODS_NAME_FIELD = "goodsName";
    public static final String SYS_USER_ID_FIELD = "sysUserId";
    public static final String STATUS_FIELD = "status";
    public static final String DELIVERY_TIME = "deliveryTime";
    /**
     * 解决前端Long精度丢失
     */
    private String id;

    @NotBlank(message = "商品ID不能为空")
    private String goodsId;

    @NotBlank(message = "品牌ID不能为空")
    private String brandId;

    private String brandName;

    /**
     * 品牌log地址
     */
    private String logo;

    @NotBlank(message = "商品名不能为空")
    private String goodsName;

    /**
     * 负责审核的管理员id
     */
    @NotBlank(message = "审核人不能为空")
    private String sysUserId;

    /**
     * -1 失效（新的goodsId审核记录出现时会失效尚未处理的goodsId记录） 0 待处理 1 通过  2 未通过
     */
    @NotNull(message = "状态不能为空")
    private Integer status;

    /**
     * 审核不通过的原因
     */
    private String failReason;

    /**
     * 分发时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime deliveryTime;

    /**
     * 审核时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime checkTime;


    @Override
    public String toString() {
        return "GoodsCheck{" +
                "id=" + id +
                ", goodsId='" + goodsId + '\'' +
                ", sysUserId='" + sysUserId + '\'' +
                ", status=" + status +
                ", deliveryTime=" + deliveryTime +
                ", checkTime=" + checkTime +
                '}';
    }
}
